package view;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class RootPanel extends javax.swing.JPanel
{

    protected JLabel contentBackground;
    protected JFrame window;
    protected Date date;

    protected void Show()
    {
        this.setVisible(false);
        this.setBounds(183, 38, 816, 700);
        window.add(this);
        this.setVisible(true);
    }

    protected void setBackground(String name)
    {
        contentBackground = new JLabel(new ImageIcon(RoomCategoryPanel.class.getResource("/data/" + name + ".png")));
        this.contentBackground.setBounds(0, 0, 796, 585);
        this.add(contentBackground);
    }
    protected WindowAdapter onClose = new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent arg0)
        {
            window.setEnabled(true);
        }
    };

    protected void setBgSearch(int x, int y)
    {
        contentBackground = new JLabel(new ImageIcon(RoomCategoryPanel.class.getResource("/data/bg_search.png")));
        this.contentBackground.setBounds(x, y, 488, 36);
        this.add(contentBackground);

    }

    protected void setBgSelect(int x, int y)
    {
        contentBackground = new JLabel(new ImageIcon(RoomCategoryPanel.class.getResource("/data/bg_select.png")));
        this.contentBackground.setBounds(x, y, 236, 132);
        this.add(contentBackground);

    }

    protected void setTime()
    {
        JLabel jlTime = new JLabel();
        SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");
        date = new Date();
        jlTime.setBounds(680, 1, 150, 25);
        jlTime.setFont(new java.awt.Font("Tahoma", 0, 13));
        jlTime.setText(dateformat.format(date));
        this.add(jlTime);
        contentBackground = new JLabel(new ImageIcon(RoomCategoryPanel.class.getResource("/data/timer.png")));
        this.contentBackground.setBounds(646, 0, 150, 25);
        this.add(contentBackground);
    }
}
